package it.appetite;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class MainActivity extends Activity {
	
	private MainActivity cxt;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.cxt = this;
        
        this.showAlert();
        
        View.OnClickListener gestore = new View.OnClickListener() {
        	public void onClick(View view) { 

        		Intent intent = null;
        		
        		switch(view.getId()){

        		case R.id.liveImg:
        			intent = new Intent(cxt, LiveActivity.class);
        			break;

        		case R.id.mediaImg:
        			intent = new Intent(cxt, MediaActivity.class);
        			break;
        			
        		case R.id.appetiteImg:
        			intent = new Intent(cxt, AppetiteActivity.class);
        			break;
        			
        		case R.id.newsImg:
        			intent = new Intent(cxt, NewsActivity.class);
        			break;
        			
        		case R.id.bandImg:
        			intent = new Intent(cxt, BandActivity.class);
        			break;
        			
        		case R.id.socialImg:
        			intent = new Intent(cxt, SocialActivity.class);
        			break;
        		}
        		
        		startActivity(intent);
        	}
        };
        
        ImageView liveImg = (ImageView) findViewById(R.id.liveImg);
        ImageView mediaImg = (ImageView) findViewById(R.id.mediaImg);
        ImageView appetiteImg = (ImageView) findViewById(R.id.appetiteImg);
        ImageView newsImg = (ImageView) findViewById(R.id.newsImg);
        ImageView bandImg = (ImageView) findViewById(R.id.bandImg);
        ImageView socialImg = (ImageView) findViewById(R.id.socialImg);
        
        liveImg.setOnClickListener(gestore);
        mediaImg.setOnClickListener(gestore);
        appetiteImg.setOnClickListener(gestore);
        newsImg.setOnClickListener(gestore);
        bandImg.setOnClickListener(gestore);
        socialImg.setOnClickListener(gestore);
    }
    
    
    private void showAlert() {
		AlertDialog.Builder miaAlert = new AlertDialog.Builder(this);
		miaAlert.setIcon(R.drawable.live_icon);
		miaAlert.setTitle("Prossima Data");
		miaAlert.setMessage("03/03/2012 VooDoo Child, Caltana");

		miaAlert.setCancelable(false);
		miaAlert.setPositiveButton("OK",
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {

					}
				});

		AlertDialog alert = miaAlert.create();
		alert.show();
	}
    
    
}